import { Router } from 'hyper-express';
import requireUser from '../../../middlewares/auth/requireUser';
import cache from '../../../middlewares/cache';
import rowLevelPermission from '../../../middlewares/auth/rowLevelPermission';
//#region AutoCreateCode
import { uctooWechatopenController } from '../../../controllers';
const uctoowechatopenRouter = new Router();
const wechatopenController = new uctooWechatopenController();

uctoowechatopenRouter.post('/add', requireUser, wechatopenController.add);
uctoowechatopenRouter.post('/edit', requireUser, rowLevelPermission('uctoo/wechatopen'), wechatopenController.edit);
uctoowechatopenRouter.post('/del', requireUser, rowLevelPermission('uctoo/wechatopen'), wechatopenController.delete);

//For getting wechatopen with permission control
uctoowechatopenRouter.get('/:id', requireUser,  rowLevelPermission('uctoo/wechatopen'), wechatopenController.getSingle);
uctoowechatopenRouter.get('/:limit/:page', requireUser,  rowLevelPermission('uctoo/wechatopen'), wechatopenController.getMany);
uctoowechatopenRouter.get('/:limit/:page/:skip', requireUser,  rowLevelPermission('uctoo/wechatopen'), wechatopenController.getMany);

//#endregion AutoCreateCode
uctoowechatopenRouter.post('/componentVerifyTicket', wechatopenController.componentVerifyTicket);
uctoowechatopenRouter.post('/server/:authorizer_id', wechatopenController.server);
uctoowechatopenRouter.get('/bindcomponent', wechatopenController.bindcomponent);
uctoowechatopenRouter.get('/authCallback', wechatopenController.authCallback);
uctoowechatopenRouter.get('/getFirstFromDb', wechatopenController.getFirstFromDb);
uctoowechatopenRouter.post('/createJssdkConfig', wechatopenController.createJssdkConfig);
export default uctoowechatopenRouter;
